<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LAPACK build and test guide</title>
<link rel="stylesheet" type="text/css" href="https://gcc.gnu.org/gcc.css" />
</head>

<body>
<h1>LAPACK build and test guide</h1>

<p>This page is a guide to building the LAPACK linear algebra
package and running its testing and timing programs.</p>

<h2>Build</h2>

<p>It is assumed that you already downloaded LAPACK from the
netlib repository at <a href="http://www.netlib.org/lapack/lapack.tgz">
lapack.tgz</a>. This is a 5 Mb file.</p>

<p>To build it, perform the following:</p>
<ul>
<li>Unpack the .tgz file:
    <ul>
    <li><code>tar zxf lapack.tgz</code>, or</li>
    <li><code>gunzip -c lapack.tgz | tar xf -</code></li>
    </ul>
</li>
<li>Change directory to the repository thus created:
    <ul>
    <li><code>cd LAPACK</code></li>
    </ul>
</li>
<li>Edit the include file of the main Makefile (<code>make.inc</code>):
    <ul>
    <li><code>PLAT = G77</code></li>
    <li><code>FORTRAN = /your/full/path/to/g77</code></li>
    <li><code>OPTS = -g -O2 -funroll-loops</code></li>
    <li><code>NOOPT = -g</code></li>
    <li><code>LOADER = $(FORTRAN)</code></li>
    <li><code>LOADOPTS =</code></li>
    <li><code>RANLIB = ranlib</code></li>
    <li><code>BLASLIB = ../../blas$(PLAT).a</code></li>
    </ul>
    Note that the value of RANLIB depends on ranlib being
    available (and necessary) on your operating system.
</li>
<li>If you want to test LAPACK with an uninstalled compiler,
    change the following in the above:
    <ul>
    <li>Add: <code>GCC_DIR = /path/to/gcc/build/directory</code></li>
    <li>Change: <code>FORTRAN = $(GCC_DIR)/gcc/g77 -B$(GCC_DIR)/gcc/</code></li>
    <li>Change: <code>LOADER = $(FORTRAN) -L$(GCC_DIR)/&lt;target&gt;/libf2c</code></li>
    </ul>
    where <code>&lt;target&gt;</code> is the target triple for your system (e.g.
    <code>mips-sgi-irix6.5</code>)
</li>
</ul>

<p>The uncompressed LAPACK distribution comprises some 35 Mb of source files.
Building the libraries, test and timing programs adds between 80 and 100
Mb of objects, libraries and executables to this.</p>

<p>A final note:  On 64-bit targets, LAPACK cannot be built using GCC 2.95.2
without specifying the <code>-femulate-complex</code> flag.  Building it
using GCC 3.0 should not need that flag.</p>

<p>On Alphas it is necessary to add the flag <code>-mieee</code> to OPTS,
NOOPT and LOADOPTS.</p>

<h2>Run</h2>

<p>The LAPACK Makefile assumes that you have the current
directory in your path.  If this is not the case in your
shell setup, use the following command line:</p>

<code>(PATH=$PATH:. export PATH;
make install blaslib lapacklib tmglib testing blas_testing)</code>

<p>If the main memory in your machine is 512 Mbyte or larger,
you are able to run the timing programs in addition to the
testing programs that are run with the command above.  In that
case, issue the command:</p>

<code>(PATH=$PATH:. export PATH;
make install blaslib lapacklib tmglib
testing blas_testing timing blas_timing)</code>

<h2>Testing</h2>

<p>The output of the testing programs gets written into
files with extension .out in the TESTING subdirectory of
the main LAPACK directory.  Use the command <code>grep -i
fail *.out</code> to find the number of failing tests.</p>

<p>GCC 3.0 should not result in more failures than GCC 2.95.2</p>

<h2>Timing</h2>

<p>TBD</p>

<h2>Cleanup</h2>

<p>Cleanup (to prepare the directory for a fresh run, e.g.
with another version of the compiler), has to be done as follows:</p>

<code>(PATH=$PATH:. export PATH; make clean;
rm `find . -name '*.SUMM' -print`)</code>

<p>The reason for this is that the LAPACK programs leave files
behind with the extension .SUMM, which are opened with <code>
STATUS='NEW'</code> - this will result in an abort if the files
already exist.</p>

</body>
</html>
